When a user opens a jquery ui popup, next he scrolls the page, the model popup window also moving. If you want to stay the model popup window fixed on the scroll. Then create a css class with fixed position,
jQuery dialog position example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/blitzer/theme.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.fixed-dialog{
position: fixed;
top: 50px;
left: 50px;
}
</style>
$(function ()
$("#dialog1").dialog({
modal: true,
autoOpen: false,
title: "jQuery Dialog",
resizable: false,
draggable: true,
width: 'auto',
dialogClass: 'fixed-dialog'
});
$(".opener").click(function () {
$("#dialog1").dialog('open');
});
});
<button class="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" align="center" hidden="hidden">
<div class="body">
<img id="image" src="/image/koala.jpg"/>
<br />
</div>
</div>
Description:
The following example works fine and fix the jQuery ui dialog box css scrolling issue.
Post your comments / questions
Recent Article
- How to create custom 404 error page in Django?
- Requested setting INSTALLED_APPS, but settings are not configured. You must either define..
- ValueError:All arrays must be of the same length - Python
- Check hostname requires server hostname - SOLVED
- How to restrict access to the page Access only for logged user in Django
- Migration admin.0001_initial is applied before its dependency admin.0001_initial on database default
- Add or change a related_name argument to the definition for 'auth.User.groups' or 'DriverUser.groups'. -Django ERROR
- Addition of two numbers in django python
Related Article